package com.bdqn.pojo.goods;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bdqn.pojo.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 秒杀商品
 *
 * @author LILIBO
 * @since 2023-04-25
 */
@Tag(name = "秒杀商品")
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("`seckill`")
public class Seckill extends Model {

    /**
     * 秒杀活动ID
     */
    @Schema(name = "秒杀活动ID")
    @TableId(type = IdType.ASSIGN_ID) // 使用雪花算法生成ID
    private Long id;

    /**
     * 商品ID
     */
    @Schema(name = "商品ID")
    private Long productId;

    /**
     * 秒杀价格
     */
    @Schema(name = "秒杀价格")
    private Double seckillPrice;

    /**
     * 库存数量
     */
    @Schema(name = "库存数量")
    private Integer stockCount;

    /**
     * 开始时间
     */
    @Schema(name = "开始时间")
    private String startTime;

    /**
     * 结束时间
     */
    @Schema(name = "结束时间")
    private String endTime;

    /**
     * 乐观锁版本号
     */
    @Schema(name = "乐观锁版本号")
    private Integer version;

    public Seckill(Long productId, Double seckillPrice, Integer stockCount, String startTime, String endTime) {
        this.productId = productId;
        this.seckillPrice = seckillPrice;
        this.stockCount = stockCount;
        this.startTime = startTime;
        this.endTime = endTime;
    }

}
